{template 'web/common/common'}
{template 'web/system/navbar'}
<link rel="stylesheet" type="text/css" href="../addons/{php echo $_GPC['m']}/resource/swal/dist/sweetalert2.min.css" />
<div class="panel panel-success">
    <div class="panel-heading">
        <h3 class="panel-title">
            小程序模板消息配置
        </h3>
    </div>
    <div class="panel-body">
        <form id="sign-form" class="form-horizontal" enctype="multipart/form-data" role="form" method="post" action="{url 'site/entry/system',array('m'=>'kundian_farm','op'=>'mini_template_set_save','version_id'=>$_GPC['version_id'])}" name="submit" style="padding: 20px 0;" >
            <input type="hidden" name="id" value="{$list['id']}">
            <div class="form-group">
                <label class="col-sm-2 control-label">微信小程序模板消息ID</label>
                <div class="col-sm-8">
                    <input type="text" class="form-control"  name="wx_small_template_id" value="{$list['wx_small_template_id']}">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-2 control-label"></label>
                <div class="col-sm-8">
                    <span style="color: gray;">模板消息：搜索“付款成功通知”=》ID：AT0005;选择关键词：物品名称，付款时间，付款金额。
                    <a target="_blank" href="{$_W['siteroot']}/addons/kundian_farm/resource/img/mini_template_03.png">查看详细</a>
                    </span>
                </div>
            </div>

            <div class="form-group">
                <label class="col-sm-2 control-label">微信小程序模板消息ID</label>
                <div class="col-sm-8">
                    <input type="text" class="form-control"  name="mini_device_template_id" value="{$list['mini_device_template_id']}">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-2 control-label"></label>
                <div class="col-sm-8">
                    <span style="color: gray;">该模板消息用于用户操作浇水、施肥成功通知！模板消息：搜索“设备状态提醒”=》ID：AT0151;选择关键词：设备编号、提示信息、时间。
                        <a target="_blank" href="{$_W['siteroot']}/addons/kundian_farm/resource/img/mini_template_01.png">查看详细</a>
                    </span>
                </div>
            </div>

            <div class="form-group">
                <label class="col-sm-2 control-label">微信小程序模板消息ID</label>
                <div class="col-sm-8">
                    <input type="text" class="form-control"  name="mini_services_template_id" value="{$list['mini_services_template_id']}">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-2 control-label"></label>
                <div class="col-sm-8">
                    <span style="color: gray;">该模板消息用于用户操作除草、杀虫业务受理通知！模板消息：搜索“业务受理通知”=》ID：AT0025;选择关键词：业务标题、受理状态、操作时间。
                    <a target="_blank" href="{$_W['siteroot']}/addons/kundian_farm/resource/img/mini_template_02.png">查看详细</a>
                    </span>
                </div>
            </div>

            <div class="form-group">
                <div class="col-sm-offset-2 col-sm-10">
                    <button type="submit" class="btn btn-success">保存</button>
                </div>
            </div>

        </form>
    </div>
</div>

<script>
    require(["../addons/{php echo $_GPC['m']}/resource/swal/dist/sweetalert2.min.js"],function(){
        $(function(){
            //删除
            $(".deleteWxOpenid").click(function(){
                var that=$(this);
                var id=$(this).attr('data-wxid');
                var shop_id=$("input[name='id']").val();
                swal({
                    title: '确定删除吗?',
                    text: "确定删除吗?",
                    type: 'warning',
                    showCancelButton: true,
                    confirmButtonColor: '#3085d6',
                    cancelButtonColor: '#d33',
                    confirmButtonText: '删除',
                    cancelButtonText: '取消',
                }).then(function(isConfirm) {
                    if (isConfirm) {
                        $.ajax({
                            type:"post",
                            url:"{url 'site/entry/'.$_GPC['do'],array('m'=>$_GPC['m'],'op'=>'deleteOpenid','version_id'=>$_GPC['version_id'])}",
                            data:{id:id},
                            dataType:'json',
                            success:function(res){
                                if(res.status==1){
                                    swal('操作成功!', '操作成功!', 'success');
                                    that.remove();
                                    $(".wx_openid_"+id).remove();
                                }else{
                                    swal('操作失败!', '操作失败!', 'error');
                                }
                            }
                        })
                    }
                })
            });
        })
    })
</script>